<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %><%--
  Created by IntelliJ IDEA.
  User: jiangxuchuan
  Date: 2022/1/4
  Time: 14:59
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>IsPrime</title>
</head>
<body>
    <%!
        boolean IsPrime(int num){
            boolean flag = true;
            for (int i = 2;i<num;i++){
                if (num % i == 0){
                    flag = false;
                    break;
                }
            }
            return flag;
        }
    %>
    <%
        List<Integer> result = new ArrayList<>();
        for (int i = 0;i<1000;i++){
            if (IsPrime(i)){
                result.add(i);
            }
        }
    %>
    <%
        for (int num:result){

    %>
<%--    需要动态输出的地方用<%= %> --%>
    <h1><%= num %>是质数</h1><br>
    <%
        }
    %>
</body>
</html>
